package level.editor.view.group;

import java.awt.LayoutManager;

import javax.swing.Icon;
import javax.swing.JPanel;

import level.editor.view.Window;

public abstract class Item extends JPanel
{
	public Item(LayoutManager manager)
	{
		super(manager);
	}

	
	
	public void setIcon(Icon icon)
	{
		this.icon = icon;
	}

	public Icon getIcon()
	{
		return icon;
	}
	
	@Override
	public void setName(String string)
	{
		super.setName(string);
//		if (getParent() != null && getParent().getParent() != null)
//		{
//			Group group = (Group) getParent().getParent();
//			if (group != null && group.getParent() != null
//					&& group.getParent() instanceof JLayeredPane)
//			{
//				InternalFrame frame = (InternalFrame) group.getRootPane()
//						.getParent();
//				frame.setTitle(getName());
//			}
//		}
	}
	
	protected Window getWindow()
	{
		if (getParent() != null && getParent().getParent() != null)
		{
			Group group = (Group) getParent().getParent();
			if (group.getWindow() != null)
				return group.getWindow();
		}
		return null;
	}
	
	protected Icon icon;
}
